﻿using System;
using System.Collections.Generic;
using System.Text;
using System.Configuration;

namespace Liger.Common
{   
    /// <summary>
    /// 缓存配置 
    /// 比如： <section name="LigerCacheConfig" type="Liger.Common.CacheConfiguration,Liger.Common"/>
    /// </summary>
    public class CacheConfiguration : ConfigurationSection
    {
        /// <summary>
        /// 默认值
        /// </summary>
        private bool? enableCache = null; 

        /// <summary>
        /// 是否开启缓存
        /// 比如：<LigerCacheConfig enable="true" />
        /// </summary>
        [ConfigurationProperty("enable")]
        public bool Enable
        {
            get
            {
                if (enableCache.HasValue)
                    return enableCache.Value;

                if (this["enable"] == null)
                    return false;

                return (bool)this["enable"];

            }
            set { enableCache = value; }
        } 
    }
}
